package com.watchthelan.web.administrator;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.mvc.SimpleFormController;

import com.watchthelan.domain.Administrator;
import com.watchthelan.service.administrator.AdministratorManager;

public class AdministratorDeleteFormController extends SimpleFormController {
	/** Logger for this class and subclasses */
	protected final Log logger = LogFactory.getLog(getClass());
	
	private AdministratorManager administratorManager;
		
	protected Object formBackingObject(HttpServletRequest request) throws ServletException {
		logger.info("delete administrator");
		Administrator administrator = new Administrator();
		String id = request.getParameter("id");
		logger.info("id = " + id);
		if (id != null) {
			this.administratorManager.deleteAdministratorById(new Long(id));
		}
		return administrator;
	}

	public void setAdministratorManager(AdministratorManager administratorManager) {
		this.administratorManager = administratorManager;
	}
}
